<template>
   <div>
     <detail-banner
       :sightName="sightName"
       :bannerImg="bannerImg"
       :gallaryImgs="gallaryImgs"></detail-banner>
     <detail-header></detail-header>
     <div class="content">
       <detail-list :list="categoryList"></detail-list>
     </div>
   </div>
</template>

<script>
import DetailBanner from './component/Banner'
import DetailHeader from './component/Header'
import DetailList from './component/list'
import axios from 'axios'
export default {
  name: 'Detail',
  components: {
    DetailBanner,
    DetailHeader,
    DetailList
  },
  data () {
    return {
      sightName: '',
      bannerImg: '',
      gallaryImgs: [],
      categoryList: []
    }
  },
  mounted () {
    this.getDetailInfo()
  },
  methods: {
    getDetailInfo () {
      axios.get(`/api/detail.json?id=${this.$route.params.id}`).then(this.getDetailInfoSuc)
    },
    getDetailInfoSuc (res) {
      res = res.data
      if (res.data && res.ret) {
        res = res.data
        this.sightName = res.sightName
        this.bannerImg = res.bannerImg
        this.gallaryImgs = res.gallaryImgs
        this.categoryList = res.categoryList
      }
    }
  }
}
</script>
<style lang="stylus" scoped>
  .content
    height 50rem
</style>
